package com.changgou.goods.dao;

import com.changgou.goods.pojo.Spec;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface SpecMapper extends Mapper<Spec> {

    /**
     * 根据分类名称查询规格列表
     * @param cateName
     * @return
     */
    @Select("SELECT DISTINCT a.* FROM tb_spec a JOIN tb_category b " +
            "ON a.template_id = b.template_id WHERE b.name=#{name}")
    List<Spec> findSpecByCateName(@Param("name") String cateName);
}
